import request from '@/utils/request'

// 发送消息
export function sendMessage(data) {
  return request({
    url: '/secondVitim/message/send',
    method: 'post',
    data: data
  })
}

// 获取消息列表（支持分页和筛选）
export function getMessageList(query) {
  return request({
    url: '/secondVitim/message/list',
    method: 'get',
    params: query
  })
}

// 获取未读消息数量
export function getUnreadCount(userId) {
  return request({
    url: '/secondVitim/message/unreadCount?userId=' + userId,
    method: 'get'
  })
}

// 标记消息为已读
export function markMessageAsRead(messageIds) {
  return request({
    url: '/secondVitim/message/read',
    method: 'put',
    data: { messageIds: messageIds }
  })
}

// 获取会话列表
export function getConversationList(userId) {
  return request({
    url: '/secondVitim/message/conversations?userId=' + userId,
    method: 'get'
  })
}




